#coding=utf-8
import arcpy
import json
import F

arcpy.env.overwriteOutput = True
with open(r'E:\数据\高德数据\水泥.json'.decode('utf-8'), 'rb') as file:
    content = file.read().decode('utf-8')
data = json.loads(content)

dataCount = len(data['pois'])
cnList = []
for i in range(dataCount):
    name = data['pois'][i]['name']
    county = data['pois'][i]['adname']
    address = data['pois'][i]['address']
    p_x = float(data['pois'][i]['location'].split(',')[0])
    p_y = float(data['pois'][i]['location'].split(',')[1])
    p_x_trans = F.gcj02_to_wgs84(p_x,p_y)[0]
    p_y_trans = F.gcj02_to_wgs84(p_x,p_y)[1]
    cnList.append( [p_x_trans,p_y_trans,name,county,address])
p = arcpy.CreateFeatureclass_management(r'e:\test','polution_factory2','POINT')
arcpy.AddField_management(p,'name','TEXT')
arcpy.AddField_management(p,'county','TEXT')
arcpy.AddField_management(p,'address','TEXT')
yb = arcpy.da.InsertCursor(p,['SHAPE@X','SHAPE@Y','name','county','address'])
for cn in cnList:
    yb.insertRow(cn)
del yb